Starting OpenJDK 10, the 'javah' utility is no more provided [1], and
its functionality is provided by 'javac' itself. Hence, do not error
out on missing 'javah', and store whether it was found; in case it is
not, then:
1) assume 'javac' has the -h parameter to generate the C header, and
make use of it
2) tell the buildsystem that com_redhat_et_libguestfs_GuestFS.h depends
on the JAR, since the the header is generated at the step (1)
[1] https://bugs.java.com/view_bug.do?bug_id=JDK-
8182758
Gbp-Pq: Name 0013-java-support-OpenJDK-10.patch
JAVAC_FLAGS = $(EXTRA_JAVAC_FLAGS) -encoding utf-8
JAVADOC_FLAGS = -encoding utf-8
+if !HAVE_JAVAH
+JAVAC_FLAGS += -h .
+endif
# Java source.
BUILT_SOURCES = com_redhat_et_libguestfs_GuestFS.h
+if HAVE_JAVAH
+
com_redhat_et_libguestfs_GuestFS.h: $(java_prefix)/GuestFS.class
rm -f $@
$(JAVAH) -classpath $(srcdir):. com.redhat.et.libguestfs.GuestFS
+else
+
+com_redhat_et_libguestfs_GuestFS.h: libguestfs-${VERSION}.jar
+
+endif
+
# Documentation.
noinst_SCRIPTS = doc-stamp
else
JAVAC="$JAVA/bin/javac"
fi
- if test ! -x "$JAVA/bin/javah"; then
- AC_MSG_ERROR([missing $JAVA/bin/javah binary])
- else
+ if test -x "$JAVA/bin/javah"; then
JAVAH="$JAVA/bin/javah"
fi
if test ! -x "$JAVA/bin/javadoc"; then
AC_SUBST(JNI_VERSION_INFO)
fi
+AM_CONDITIONAL([HAVE_JAVAH],[test -n "$JAVAH"])
AM_CONDITIONAL([HAVE_JAVA],[test "x$with_java" != "xno" && test -n "$JAVAC"])